package cn.webrx;

import java.util.*;

public class List9 {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();
        int size = 9;
        for (int i = 0; i < size; i++) {
            list.add("list" + i);
        }

        long st = System.currentTimeMillis();
        //循环遍历
        for (int i = 0; i < size; i++) {
            list.get(i);
            //System.out.println(list.get(i));
        }
        long et = System.currentTimeMillis();
        System.out.println("List-for:" + (et - st));


        System.out.println("----");
        st = System.currentTimeMillis();
        //
        Iterator<String> it = list.iterator();
        if(it.hasNext()){
            String t = it.next();
            System.out.println(t);
        }

        et = System.currentTimeMillis();
        System.out.println("Iterator-for:" + (et - st));

        HashMap hm;
    }
}
